package com.wn.controller;

import com.wn.annotation.RequireRoles;
import com.wn.entity.Area;
import com.wn.service.AreaService;
import com.wn.utils.Rsp;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Area)表控制层
 *2223333333666
 * @author makejava
 * @since 2020-10-24 11:34:31
 */
@RestController
@RequestMapping("area")
public class AreaController {
    /**
     * 服务对象
     */
    @Resource
    private AreaService areaService;

    /**
     * 通过主键查询单条数据
     *
     * @return 单条数据
     */
    @PostMapping("/selectOne")
    public Area selectOne(@RequestBody Area area) {

        return this.areaService.queryById(area.getKeyid());
    }

    @GetMapping("/selectProvince")
    public Rsp queryByLevel(){return this.areaService.queryByLevel();}

    @PostMapping("/selectRegionById")
    public Rsp queryByParentCode(@RequestBody Area area){return this.areaService.queryByParentCode(area.getParentcode());}

    @PostMapping("/queryAll")
    public Rsp queryAll(@RequestBody Area area){return this.areaService.queryAll(area);}

}